package org.mindrive.system.service;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.mindrive.system.service.schedule.ScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 定时任务
 *
 * @author lixin
 */
@Slf4j
@Component
@Async
public class ScheduledService {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 每日1点执行一次：
     * 判断今日是否为周一
     * 自动生成本周日程
     *
     * @Author mwh
     * @Date 11:27 2023/12/28
     **/
    @Scheduled(cron = "0 0 1 * * ?")
//    @Scheduled(cron = "0 */1 * * * ?")
    public void scheduleEveryDay() {
        log.info("生成周日程定时任务 开始");
        scheduleService.dingShiCreate();
        log.info("生成周日程定时任务 完成");
    }




}